﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data;
using MySql.Data.MySqlClient;

    class DalShift
    {
        public static BizShift getShiftbyID(string pShift_charid)
        {
            Friesland_Campina_CRM_DataContext db = new Friesland_Campina_CRM_DataContext(new MySqlConnection(Thuvien.getConnString()));
            try
            {
                var shift = db.Shift.Single(p => p.ShiftCharID == pShift_charid);
                return new BizShift(shift.ShiftCharID, shift.Name, shift.StartTime, shift.MiddleTime, shift.EndTime);
            }
            catch(Exception ex)
            {
                return null;
            }
        }
    }

